//package com.kanq.service.mybatis;
//
//import com.kanq.service.mybatis.mapper.UserMapper;
//import net.sf.cglib.proxy.InvocationHandler;
//import net.sf.cglib.proxy.Proxy;
//import org.apache.ibatis.session.SqlSession;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.checkerframework.common.reflection.qual.Invoke;
//import org.springframework.beans.factory.FactoryBean;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.lang.reflect.Method;
//
///**
// * @Author cheng jun
// * @Description:
// * @Date 2021/7/18 22:21
// */
//public class FactoryBeanDemo implements FactoryBean {
//
//    private Class mapperClass;
//    private SqlSession sqlSession;
//
//    public FactoryBeanDemo(Class mapperClass) {
//        this.mapperClass = mapperClass;
//    }
//
//    /*@Autowired
//    public void setSqlSession(SqlSessionFactory sqlSessionFactory) {
//        this.sqlSession = sqlSessionFactory.openSession();
//    }*/
//
//    @Override
//    public Object getObject() {
//        Object proxyInstance = Proxy.newProxyInstance(FactoryBeanDemo.class.getClassLoader(), new Class[]{mapperClass}, new InvocationHandler() {
//            @Override
//            public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
//                System.out.println(method.getName());
//                return null;
//            }
//        });
//        return proxyInstance;
//        //return sqlSession.getMapper(mapperClass);
//    }
//
//    @Override
//    public Class<?> getObjectType() {
//        return UserMapper.class;
//    }
//}
